package com.ayz.gateway.core.core.common;


import com.ayz.gateway.core.session.http.HttpCommandType;
import io.netty.handler.codec.http.HttpMethod;

/**
 * @ClassName CommondTypeConvert
 * @Description TODO: 指令类型的转换器
 * @Author 快乐的星球
 * @Date 2023/5/8 18:11
 * @Version 1.0
 **/
public class CommandTypeConvert {

    public static HttpCommandType convert(HttpMethod httpMethod){
        if(httpMethod==HttpMethod.GET){
            return HttpCommandType.GET;
        }else if(httpMethod==HttpMethod.POST){
            return HttpCommandType.POST;
        }else if(httpMethod==HttpMethod.PUT){
            return HttpCommandType.PUT;
        }else if(httpMethod==HttpMethod.DELETE) {
            return HttpCommandType.DELETE;
        }
        throw new IllegalArgumentException("当前的请求方式不被许可!httpMethod:"+httpMethod.name());
    }
}
